public with sharing class CashFlow3 {
	
	
	//List off Opportunitys with Stage"Geschlossene und gewonnene"
	public Opportunity[] oppsList{get;set;}
	// Startdatum is the first of the Month
	public Date dateStart{get;set;}
	//End Datum is the end of the Month
	public Date dateEnd{get;set;}
	// list of all Kreditoren  and OpportunityLineItems from 1-31 of the Month, with the status unpaid and in an Opp in the oppsList
	public DebListObj__c[] myListAllInvoices{get;set;}
	// only Kreditors but is now not use 
	public DebListObj__c[] myListOnlyKred{get;set;}
	// list of on OpportunityLineItems not used
	public DebListObj__c[] myListOnlyDeb{get;set;}
	// list of Ked+OppLinitems for 1-31 in result (Summe)
	public DebListObj__c[] myResultList{get;set;}
	// the Map with the Day as int and the Currency of the Result(SummenListe) 
	public Map<Integer,double> resultDoublemap{get;set;}
	
	// not used just to check the size of the resultDoublemap lasse ich mir anzeigen.
	public Integer sizeresultDoublemap{get;set;}
	
	// List of the bankkonto Stand on the 1 till 31 of the current Month
	public double[] bankkontoStand {get;set;}
	// the Position of System.today(). in the current Month
	public Integer bankListPosition{get;set;}
	// our bankkontoObj that is shown in the Page
	public DebListObj__c[] bankkontoObj{get;set;}
	// get the sum of bank account
	public Double dSumOfBank{get;set;}
	// get the last booking date of bank account
	public Date dateLastBookingDate{get;set;}

	/*
	---------------------------------- Constructor -------------------------------------------------------------------------------
	*/
	// constuctor
	public CashFlow3(ApexPages.StandardController stdController){
		oppsList = new List<Opportunity>();
		myListAllInvoices = new List<DebListObj__c>();
		
		myListOnlyKred=new List<DebListObj__c>();
		myListOnlyDeb=new List<DebListObj__c>();
		myResultList = new List<DebListObj__c>();
		dateStart = System.today().toStartOfMonth();
		dateEnd = System.today().toStartOfMonth().addMonths(1).addDays(13);
		// fill the bankkontoStand with 0.0
		bankkontoStand = new Double[]{	0,0,0,0,0,0,0,0,0,0,
										0,0,0,0,0,0,0,0,0,0,
										0,0,0,0,0,0,0,0,0,0,
										0,0,0,0,0,0,0,0,0,0,
										0,0,0,0,0,0};
		bankListPosition = 0;
		bankkontoObj = new List<DebListObj__c>();
		
		resultDoublemap = new Map<Integer, Double>();
		// fill the OppList
		fillLists();
		splittOpps();
		fillResult();
		fillBankKonto();
		
		// get the sum of bank account
		AggregateResult[] groupedResults = [Select SUM(Betrag__c) sBank From Bank_Konto__c WHERE Kontonummer__c = '667990343'];
		dSumOfBank = (double)groupedResults[0].get('sBank');
		//System.debug(' +++++++++++++++   Sum of Bank amount: ' + dSumOfBank.format() + ' EURO ++++++++++++++++');
		
		// get the last booking date of bank account
		dateLastBookingDate = [Select Id, Buchungsdatum__c From Bank_Konto__c WHERE Kontonummer__c = '667990343' ORDER BY Buchungsdatum__c DESC  LIMIT 1].Buchungsdatum__c;
		//System.debug(' +++++++++++++++   Date of Last Bank Entry: ' + dateLastBookingDate.format() + '  ++++++++++++++++');
	}// END constuctor CashFlow3
	
	/*
	---------------------------------- Funktion to fill the bankkontoStand List -----------------------------------------
	*/
	
	public void fillBankKonto(){
		double sum = 0.0;
		//put all Kontostand at Position i till System.today();
		for(Integer i= dateStart.day(); i<System.today().day();i++){
			AggregateResult[] groupedResults = [Select SUM(Betrag__c) sBank From Bank_Konto__c WHERE Kontonummer__c = '667990343' AND Buchungsdatum__c<=: dateStart.addDays(bankListPosition)];
			sum = (double)groupedResults[0].get('sBank');
			bankkontoStand[bankListPosition]= sum;
			bankListPosition = bankListPosition+1;
		}
		// muss geändert werden nicht nur bis 31 sondern bis 45
		for(Integer i= bankListPosition;i<45;i++){
			bankkontoStand[i]= bankkontoStand[i-1] + resultDoublemap.get(i+1);
		}
		DebListObj__c tempDb = new DebListObj__c();
		tempDb.debDueDate01__c =  bankkontoStand[0];
		tempDb.debDueDate02__c =  bankkontoStand[1];
		tempDb.debDueDate03__c =  bankkontoStand[2];
		tempDb.debDueDate04__c =  bankkontoStand[3];
		tempDb.debDueDate05__c =  bankkontoStand[4];
		tempDb.debDueDate06__c =  bankkontoStand[5];
		tempDb.debDueDate07__c =  bankkontoStand[6];
		tempDb.debDueDate08__c =  bankkontoStand[7];
		tempDb.debDueDate09__c =  bankkontoStand[8];
		tempDb.debDueDate10__c =  bankkontoStand[9];
		tempDb.debDueDate11__c =  bankkontoStand[10];
		tempDb.debDueDate12__c =  bankkontoStand[11];
		tempDb.debDueDate13__c =  bankkontoStand[12];
		tempDb.debDueDate14__c =  bankkontoStand[13];
		tempDb.debDueDate15__c =  bankkontoStand[14];
		tempDb.debDueDate16__c =  bankkontoStand[15];
		tempDb.debDueDate17__c =  bankkontoStand[16];
		tempDb.debDueDate18__c =  bankkontoStand[17];
		tempDb.debDueDate19__c =  bankkontoStand[18];
		tempDb.debDueDate20__c =  bankkontoStand[19];
		tempDb.debDueDate21__c =  bankkontoStand[20];
		tempDb.debDueDate22__c =  bankkontoStand[21];
		tempDb.debDueDate23__c =  bankkontoStand[22];
		tempDb.debDueDate24__c =  bankkontoStand[23];
		tempDb.debDueDate25__c =  bankkontoStand[24];
		tempDb.debDueDate26__c =  bankkontoStand[25];
		tempDb.debDueDate27__c =  bankkontoStand[26];
		tempDb.debDueDate28__c =  bankkontoStand[27];
		tempDb.debDueDate29__c =  bankkontoStand[28];
		tempDb.debDueDate30__c =  bankkontoStand[29];
		tempDb.debDueDate31__c =  bankkontoStand[30];
		
		tempDb.debDueDate32__c =  bankkontoStand[32];
		tempDb.debDueDate33__c =  bankkontoStand[33];
		tempDb.debDueDate34__c =  bankkontoStand[34];
		tempDb.debDueDate35__c =  bankkontoStand[35];
		tempDb.debDueDate36__c =  bankkontoStand[36];
		tempDb.debDueDate37__c =  bankkontoStand[37];
		tempDb.debDueDate38__c =  bankkontoStand[38];
		tempDb.debDueDate39__c =  bankkontoStand[39];
		tempDb.debDueDate40__c =  bankkontoStand[40];
		tempDb.debDueDate41__c =  bankkontoStand[41];
		tempDb.debDueDate42__c =  bankkontoStand[42];
		tempDb.debDueDate43__c =  bankkontoStand[43];
		tempDb.debDueDate44__c =  bankkontoStand[44];
		tempDb.debDueDate45__c =  bankkontoStand[45];
		
		
		bankkontoObj.add(tempDb);
		
	}
	
	/*
	----------------------------------- Function to fill the OpportunityList with all their Kreditoren and Debitoren-----------------------------------------------------
	*/
	public void fillLists(){
		
		try{
			oppsList = [SELECT Id, Name, CloseDate, StageName, (SELECT UnitPrice, Startdatum__c, ServiceDate, Sales_Price_hrs__c, Quantity, ListPrice, Leistung_erbracht__c, Id FROM OpportunityLineItems WHERE ServiceDate>=:dateStart AND ServiceDate<=:dateEnd AND Leistung_erbracht__c=:false ),(SELECT Id, Invoice_amount__c, Invoice_due_on__c, Invoice_date__c, Name,Payment_Status__c FROM Invoices__r WHERE Invoice_due_on__c>=:dateStart AND Invoice_due_on__c<=: dateEnd AND Payment_Status__c =:'Unpaid') FROM Opportunity WHERE StageName=:'Geschlossene und gewonnene'];	
		}catch(QueryException ex){
			ApexPages.addMessages(ex);
		}
	}// END public void fillLists()
	
	/*
	-------------------------------- Function to check the Date of the Debitoren and Kreditoren--------------------------
	
	after checking the Date the function calls another function to fill the Amount in the right position of the myListAllInvoices ist angepasst bis 45
	*/
	public void splittOpps(){
		Date tempDate= dateStart;
		// for all opportunity with stage clost won
		for(Integer oppoN = 0; oppoN<this.oppsList.size();oppoN++){
			// for each opportunity check all OpportunityLineItems
			for(Integer debitN = 0; debitN<oppsList[oppoN].OpportunityLineItems.size();debitN++){
				DebListObj__c db1 = new DebListObj__c(debDueDate01__c = 0,debDueDate02__c = 0,debDueDate03__c = 0,debDueDate04__c = 0,debDueDate05__c = 0,debDueDate06__c = 0,debDueDate07__c = 0, debDueDate08__c = 0,
					debDueDate09__c = 0,debDueDate10__c = 0,debDueDate11__c = 0,debDueDate12__c = 0,debDueDate13__c = 0,debDueDate14__c = 0,debDueDate15__c = 0,debDueDate16__c = 0,
					debDueDate17__c = 0,debDueDate18__c = 0,debDueDate19__c = 0,debDueDate20__c = 0,debDueDate21__c = 0,debDueDate22__c = 0,debDueDate23__c = 0,debDueDate24__c = 0,
					debDueDate25__c = 0,debDueDate26__c = 0,debDueDate27__c = 0,debDueDate28__c = 0,debDueDate29__c = 0,debDueDate30__c = 0,debDueDate31__c = 0, debDueDate32__c = 0,
					debDueDate33__c = 0,debDueDate34__c = 0,debDueDate35__c = 0,debDueDate36__c = 0,debDueDate37__c = 0,debDueDate38__c = 0,debDueDate39__c = 0, debDueDate40__c = 0,
					debDueDate41__c = 0,debDueDate42__c = 0,debDueDate43__c = 0,debDueDate44__c = 0,debDueDate45__c = 0);
				
				if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate== tempDate){
					// 1. des Monats
					db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate01__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,1);
	 				//searchInmyListOnlyDeb(db1,1);
	 				
	 			}
	 			// 2. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(1)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate02__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,2);
	 				//searchInmyListOnlyDeb(db1,2);
	 				
	 			}
	 			//3. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(2)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate03__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,3);
	 				//searchInmyListOnlyDeb(db1,3);
	 			}
	 			// 4. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(3)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate04__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,4);
	 				//searchInmyListOnlyDeb(db1,4);
	 			}
	 			// 5. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(4)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate05__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,5);
	 				//searchInmyListOnlyDeb(db1,5);
	 			}
	 			//6. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(5)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate06__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,6);
	 				//searchInmyListOnlyDeb(db1,6);
	 			}
	 			//7. des Monats 
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(6)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate07__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,7);
	 				//searchInmyListOnlyDeb(db1,7);
	 				
	 			}
	 			// 8. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(7)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate08__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,8);
	 				//searchInmyListOnlyDeb(db1,8);
	 			}
	 			// 9. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(8)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate08__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,9);
	 				//searchInmyListOnlyDeb(db1,9);
	 			}
	 			// 10. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(9)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate10__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,10);
	 				//searchInmyListOnlyDeb(db1,10);
	 			}
	 			// 11. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(10)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate11__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,11);
	 				//searchInmyListOnlyDeb(db1,11);
	 			}
	 			// 12. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(11)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate12__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				
	 				searchInmyListOnlyDeb(db1,12);
	 				//searchInmyDebList(db1,12);
	 			}
	 			// 13. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(12)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate13__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,13);
	 				//searchInmyListOnlyDeb(db1,13);
	 				
	 			}
	 			// 14. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(13)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate14__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,14);
	 				//searchInmyListOnlyDeb(db1,14);
	 			}
	 			// 15. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(14)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate15__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,15);
	 				//searchInmyListOnlyDeb(db1,15);
	 			}
	 			// 16. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(15)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate16__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,16);
	 				//searchInmyListOnlyDeb(db1,16);
	 			}
	 			// 17. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(16)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate17__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,17);
	 				//searchInmyListOnlyDeb(db1,17);
	 			}
	 			// 18. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(17)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate18__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,18);
	 				//searchInmyListOnlyDeb(db1,18);
	 			}
	 			// 19. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(18)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate19__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,19);
	 				//searchInmyListOnlyDeb(db1,19);
	 			}
	 			// 20. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(19)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate20__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,20);
	 				//searchInmyListOnlyDeb(db1,20);
	 			}
	 			// 21. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(20)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate21__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,21);
	 				//searchInmyListOnlyDeb(db1,21);
	 			}
	 			// 22. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(21)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate22__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,22);
	 				//searchInmyListOnlyDeb(db1,22);
	 			}
	 			// 23. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(22)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate23__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,23);
	 				//searchInmyListOnlyDeb(db1,23);
	 			}
	 			// 24. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(23)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate24__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,24);
	 				//searchInmyListOnlyDeb(db1,24);
	 			}
	 			// 25. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(24)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate25__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,25);
	 				//searchInmyListOnlyDeb(db1,25);
	 			}
	 			// 26. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(25)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate26__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,26);
	 				//searchInmyListOnlyDeb(db1,26);
	 			}
	 			// 27. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(26)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate27__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,27);
	 				//searchInmyListOnlyDeb(db1,27);
	 			}
	 			// 28. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(27)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate28__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,28);
	 				//searchInmyListOnlyDeb(db1,28);
	 			}
	 			// 29. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(28)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate29__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,29);
	 				//searchInmyListOnlyDeb(db1,29);
	 			}
	 			// 30. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(29)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate30__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,30);
	 				//searchInmyListOnlyDeb(db1,30);
	 			}
	 			// 31. des Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addDays(30)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate31__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,31);
	 				//searchInmyListOnlyDeb(db1,31);
	 			}
	 			// 32. des Monats = 1 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate32__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,32);
	 				//searchInmyListOnlyDeb(db1,32);
	 			}
	 			// 33. des Monats = 2 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(1)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate33__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,33);
	 				//searchInmyListOnlyDeb(db1,33);
	 			}
	 			// 34. des Monats = 3 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(2)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate34__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,34);
	 				//searchInmyListOnlyDeb(db1,34);
	 			}
	 			// 35. des Monats = 4 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(3)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate35__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,35);
	 				//searchInmyListOnlyDeb(db1,31);
	 			}
	 			// 36. des Monats = 5 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(4)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate36__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,36);
	 				//searchInmyListOnlyDeb(db1,36);
	 			}
	 			// 37. des Monats = 6 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(5)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate37__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,37);
	 				//searchInmyListOnlyDeb(db1,37);
	 			}
	 			// 38. des Monats = 7 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(6)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate38__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,38);
	 				//searchInmyListOnlyDeb(db1,38);
	 			}
	 			// 39. des Monats = 8 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(7)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate39__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,39);
	 				//searchInmyListOnlyDeb(db1,39);
	 			}
	 			
	 			// 40. des Monats = 10 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(8)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate40__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,40);
	 				//searchInmyListOnlyDeb(db1,40);
	 			}
	 			
	 			// 41. des Monats = 11 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(9)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate41__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,41);
	 				//searchInmyListOnlyDeb(db1,41);
	 			}
	 			// 42. des Monats = 12 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(10)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate42__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,42);
	 				//searchInmyListOnlyDeb(db1,42);
	 			}
	 			// 43. des Monats = 13 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(11)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate43__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,43);
	 				//searchInmyListOnlyDeb(db1,43);
	 			}
	 			// 44. des Monats = 14 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(12)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate44__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,44);
	 				//searchInmyListOnlyDeb(db1,44);
	 			}
	 			// 45. des Monats = 14 des neuen Monats
	 			if(oppsList[oppoN].OpportunityLineItems[debitN].ServiceDate == tempDate.addMonths(1).addDays(13)){
	 				db1.Opportunity__c = oppsList[oppoN].Id;
	 				db1.debDueDate45__c = oppsList[oppoN].OpportunityLineItems[debitN].Quantity * oppsList[oppoN].OpportunityLineItems[debitN].UnitPrice;
	 				searchInmyDebList(db1,45);
	 				//searchInmyListOnlyDeb(db1,45);
	 			}
			}//End for(Integer debitN = 0; debitN<oppsList[oppoN].Debitoren_Rechnungen__r.size();debitN++)
			
			
			// for each opportunity check all kreditoren
			for(Integer debitN = 0; debitN<oppsList[oppoN].Invoices__r.size();debitN++){
				DebListObj__c db = new DebListObj__c(debDueDate01__c = 0,debDueDate02__c = 0,debDueDate03__c = 0,debDueDate04__c = 0,debDueDate05__c = 0,debDueDate06__c = 0,debDueDate07__c = 0, debDueDate08__c = 0,
					debDueDate09__c = 0,debDueDate10__c = 0,debDueDate11__c = 0,debDueDate12__c = 0,debDueDate13__c = 0,debDueDate14__c = 0,debDueDate15__c = 0,debDueDate16__c = 0,
					debDueDate17__c = 0,debDueDate18__c = 0,debDueDate19__c = 0,debDueDate20__c = 0,debDueDate21__c = 0,debDueDate22__c = 0,debDueDate23__c = 0,debDueDate24__c = 0,
					debDueDate25__c = 0,debDueDate26__c = 0,debDueDate27__c = 0,debDueDate28__c = 0,debDueDate29__c = 0,debDueDate30__c = 0,debDueDate31__c = 0, debDueDate32__c = 0,
					debDueDate33__c = 0,debDueDate34__c = 0,debDueDate35__c = 0,debDueDate36__c = 0,debDueDate37__c = 0,debDueDate38__c = 0,debDueDate39__c = 0, debDueDate40__c = 0,
					debDueDate41__c = 0,debDueDate42__c = 0,debDueDate43__c = 0,debDueDate44__c = 0,debDueDate45__c = 0);
				// 1. des Monats
				if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate){
					db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate01__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,1);
	 				//searchInDebList(myListOnlyKred,db,1);
	 			}
	 			// 2. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(1)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate02__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,2);
	 				//searchInDebList(myListOnlyKred,db,2);
	 			}
	 			//3. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(2)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate03__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,3);
	 				//searchInDebList(myListOnlyKred,db,3);
	 			}
	 			// 4. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(3)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate04__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,4);
	 				//searchInDebList(myListOnlyKred,db,4);
	 			}
	 			// 5. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(4)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate05__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,5);
	 				//searchInDebList(myListOnlyKred,db,5);
	 			}
	 			//6. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(5)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate06__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,6);
	 				//searchInDebList(myListOnlyKred,db,6);
	 			}
	 			//7. des Monats 
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(6)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate07__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,7);
	 				//searchInDebList(myListOnlyKred,db,7);
	 			}
	 			// 8. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(7)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate08__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,8);
	 				//searchInDebList(myListOnlyKred,db,8);
	 			}
	 			// 9. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(8)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate08__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,9);
	 				//searchInDebList(myListOnlyKred,db,9);
	 			}
	 			// 10. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(9)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate10__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,10);
	 				//searchInDebList(myListOnlyKred,db,10);
	 			}
	 			// 11. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(10)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate11__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,11);
	 				//searchInDebList(myListOnlyKred,db,11);
	 			}
	 			// 12. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(11)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate12__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,12);
	 				//searchInDebList(myListOnlyKred,db,12);
	 			}
	 			// 13. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(12)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate13__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,13);
	 				//searchInDebList(myListOnlyKred,db,13);
	 				
	 				
	 			}
	 			// 14. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(13)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate14__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,14);
	 				//searchInDebList(myListOnlyKred,db,14);
	 			}
	 			// 15. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(14)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate15__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,15);
	 				//searchInDebList(myListOnlyKred,db,15);
	 			}
	 			// 16. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(15)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate16__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,16);
	 				//searchInDebList(myListOnlyKred,db,16);
	 			}
	 			// 17. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(16)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate17__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,17);
	 				//searchInDebList(myListOnlyKred,db,17);
	 			}
	 			// 18. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(17)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate18__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,18);
	 				//searchInDebList(myListOnlyKred,db,18);
	 			}
	 			// 19. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(18)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate19__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,19);
	 				//searchInDebList(myListOnlyKred,db,19);
	 			}
	 			// 20. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(19)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate20__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,20);
	 				//searchInDebList(myListOnlyKred,db,20);
	 			}
	 			// 21. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(20)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate21__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,21);
	 				//searchInDebList(myListOnlyKred,db,21);
	 			}
	 			// 22. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(21)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate22__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInDebList(myListAllInvoices,db,22);
	 				//searchInDebList(myListOnlyKred,db,22);
	 			}
	 			// 23. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(22)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate23__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,23);
	 				//searchInDebList(myListOnlyKred,db,23);
	 			}
	 			// 24. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(23)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate24__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,24);
	 				//searchInDebList(myListOnlyKred,db,24);
	 			}
	 			// 25. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(24)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate25__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,25);
	 				//searchInDebList(myListOnlyKred,db,25);
	 			}
	 			// 26. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(25)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate26__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,26);
	 				searchInDebList(myListOnlyKred,db,26);
	 			}
	 			// 27. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(26)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate27__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c* (-1);
	 				searchInmyDebList(db,27);
	 				//searchInDebList(myListOnlyKred,db,27);
	 			}
	 			// 28. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(27)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate28__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,28);
	 				//searchInDebList(myListOnlyKred,db,28);
	 			}
	 			// 29. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(28)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate29__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,29);
	 				//searchInDebList(myListOnlyKred,db,29);
	 			}
	 			// 30. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(29)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate30__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,30);
	 				searchInDebList(myListOnlyKred,db,30);
	 			}
	 			// 31. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addDays(30)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate31__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,31);
	 				//searchInDebList(myListOnlyKred,db,31);
	 			}
	 			// 32. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate32__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,32);
	 				//searchInDebList(myListOnlyKred,db,32);
	 			}
	 			// 33. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(1)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate33__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,33);
	 				//searchInDebList(myListOnlyKred,db,33);
	 			}
	 			// 34. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(2)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate34__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,34);
	 				//searchInDebList(myListOnlyKred,db,34);
	 			}
	 			// 35. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(3)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate35__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,35);
	 				//searchInDebList(myListOnlyKred,db,35);
	 			}
	 			// 36. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(4)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate36__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,36);
	 				//searchInDebList(myListOnlyKred,db,36);
	 			}
				// 37. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(5)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate37__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,37);
	 				//searchInDebList(myListOnlyKred,db,37);
	 			}
	 			// 38. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(6)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate38__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,38);
	 				//searchInDebList(myListOnlyKred,db,38);
	 			}
	 			// 39. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(7)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate39__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,39);
	 				//searchInDebList(myListOnlyKred,db,39);
	 			}
	 			// 40. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(8)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate40__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,40);
	 				//searchInDebList(myListOnlyKred,db,40);
	 			}
	 			// 41. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(9)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate41__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,41);
	 				//searchInDebList(myListOnlyKred,db,41);
	 			}
	 			// 42. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(10)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate42__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,42);
	 				//searchInDebList(myListOnlyKred,db,42);
	 			}
	 			// 43. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(11)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate43__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,43);
	 				//searchInDebList(myListOnlyKred,db,43);
	 			}
	 			// 44. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(12)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate44__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,44);
	 				//searchInDebList(myListOnlyKred,db,44);
	 			}
	 			// 45. des Monats
	 			if(oppsList[oppoN].Invoices__r[debitN].Invoice_due_on__c == tempDate.addMonths(1).addDays(13)){
	 				db.Opportunity__c = oppsList[oppoN].Id;
	 				db.debDueDate45__c = oppsList[oppoN].Invoices__r[debitN].Invoice_amount__c * (-1);
	 				searchInmyDebList(db,45);
	 				//searchInDebList(myListOnlyKred,db,45);
	 			}
			}//End for(Integer debitN = 0; debitN<oppsList[oppoN].Invoices__r.size();debitN++)
	 	}//End for(Integer oppoN = 0; oppoN<this.oppsList.size();oppoN++)
	}// End public void splittOpps()
	
	/*
	---------------------------------------- Function to fill all the Amounts in myListAllInvoices---------------------------
	needs a myListAllInvoices and the position where it has do be set. is called by the splittOpps Function ist angepasst bis 45
	*/	
	public void searchInmyDebList(DebListObj__c d, Integer position){
		Boolean isSet = false;
		// for each myDebListObj in myListAllInvoices check if there is a Number at the Position position and the Opportunity id is the same... 
		for(Integer i= 0;i<myListAllInvoices.size();i++){
			if((myListAllInvoices[i].Opportunity__c ==d.Opportunity__c)&& (isSet==false)){
				if(positioN ==1){
						myListAllInvoices[i].debDueDate01__c = myListAllInvoices[i].debDueDate01__c + d.debDueDate01__c;
						isSet = true;
						break;
				
				}// End if(positioN ==1)
				if(positioN ==2){
						myListAllInvoices[i].debDueDate02__c =  myListAllInvoices[i].debDueDate02__c + d.debDueDate02__c;
						isSet = true;
						break;
				}// End if(positioN ==2)
				if(positioN == 3){
						myListAllInvoices[i].debDueDate03__c = myListAllInvoices[i].debDueDate03__c + d.debDueDate03__c;
						isSet = true;
						break;
				}// End if(positioN == 3)
				if(positioN ==4){
						myListAllInvoices[i].debDueDate04__c = myListAllInvoices[i].debDueDate04__c + d.debDueDate04__c;
						isSet = true;
						break;
				}// End if(positioN ==4)
				if(positioN ==5){
						myListAllInvoices[i].debDueDate05__c = myListAllInvoices[i].debDueDate05__c +d.debDueDate05__c;
						isSet = true;
						break;
				}// End if(positioN ==5)
				if(positioN ==6){
						myListAllInvoices[i].debDueDate06__c = myListAllInvoices[i].debDueDate06__c + d.debDueDate06__c;
						isSet = true;
						break;
				}// End if(positioN ==6)
				if(positioN ==7){
						myListAllInvoices[i].debDueDate07__c = myListAllInvoices[i].debDueDate07__c + d.debDueDate07__c;
						isSet = true;
						break;
				}// End if(positioN ==7)
				if(positioN ==8){
						myListAllInvoices[i].debDueDate08__c = myListAllInvoices[i].debDueDate08__c + d.debDueDate08__c;
						isSet = true;
						break;
				}// End if(positioN ==8)
				if(positioN ==9){
						myListAllInvoices[i].debDueDate09__c = myListAllInvoices[i].debDueDate09__c + d.debDueDate09__c;
						isSet = true;
						break;
				}// End if(positioN ==9)
				if(positioN ==10){
						myListAllInvoices[i].debDueDate10__c = myListAllInvoices[i].debDueDate10__c + d.debDueDate10__c;
						isSet = true;
						break;
				}// End if(positioN ==10)
				if(positioN ==11){
						myListAllInvoices[i].debDueDate11__c = myListAllInvoices[i].debDueDate11__c + d.debDueDate11__c;
						isSet = true;
						break;
				}// End if(positioN ==11)
				if(positioN ==12){
						myListAllInvoices[i].debDueDate12__c = myListAllInvoices[i].debDueDate12__c + d.debDueDate12__c;
						isSet = true;
						break;
				}// End if(positioN ==12)
				if(positioN ==13){
						myListAllInvoices[i].debDueDate13__c = myListAllInvoices[i].debDueDate13__c + d.debDueDate13__c;
						isSet = true;
						break;
				}// End if(positioN ==13)
				if(positioN ==14){
						myListAllInvoices[i].debDueDate14__c = myListAllInvoices[i].debDueDate14__c + d.debDueDate14__c;
						isSet = true;
						break;
				}// End if(positioN ==14)
				if(positioN ==15){
						myListAllInvoices[i].debDueDate15__c = myListAllInvoices[i].debDueDate15__c + d.debDueDate15__c;
						isSet = true;
						break;
				}// End if(positioN ==15)
				if(positioN ==16){
						myListAllInvoices[i].debDueDate16__c = myListAllInvoices[i].debDueDate16__c + d.debDueDate16__c;
						isSet = true;
						break;
				}// End if(positioN ==16)
				if(positioN ==17){
					
						myListAllInvoices[i].debDueDate17__c = myListAllInvoices[i].debDueDate17__c + d.debDueDate17__c;
						isSet = true;
						break;
				}// End if(positioN ==17)
				if(positioN ==18){
						myListAllInvoices[i].debDueDate18__c = myListAllInvoices[i].debDueDate18__c + d.debDueDate18__c;
						isSet = true;
						break;
				}// End if(positioN ==18)
				if(positioN ==19){
						myListAllInvoices[i].debDueDate19__c = myListAllInvoices[i].debDueDate19__c + d.debDueDate19__c;
						isSet = true;
						break;
				}// End if(positioN ==19)
				if(positioN ==20){
						myListAllInvoices[i].debDueDate20__c = myListAllInvoices[i].debDueDate20__c + d.debDueDate20__c;
						isSet = true;
						break;
				}// End if(positioN ==20)
				if(positioN ==21){
						myListAllInvoices[i].debDueDate21__c = myListAllInvoices[i].debDueDate21__c + d.debDueDate21__c;
						isSet = true;
						break;
				}// End if(positioN ==21)
				if(positioN ==22){
						myListAllInvoices[i].debDueDate22__c = myListAllInvoices[i].debDueDate22__c + d.debDueDate22__c;
						isSet = true;
						break;
				}// End if(positioN ==22)
				if(positioN ==23){

						myListAllInvoices[i].debDueDate23__c = myListAllInvoices[i].debDueDate23__c + d.debDueDate23__c;
						isSet = true;
						break;
				}// End if(positioN ==23)
				if(positioN ==24){
						myListAllInvoices[i].debDueDate24__c = myListAllInvoices[i].debDueDate24__c + d.debDueDate24__c;
						isSet = true;
						break;

				}// End if(positioN ==24)
				if(positioN ==25){
					
						myListAllInvoices[i].debDueDate25__c = myListAllInvoices[i].debDueDate25__c + d.debDueDate25__c;
						isSet = true;
						break;
					
				}// End if(positioN ==25)
				if(positioN ==26){
						myListAllInvoices[i].debDueDate26__c = myListAllInvoices[i].debDueDate26__c + d.debDueDate26__c;
						isSet = true;
						break;
				}// End if(positioN ==26)
				if(positioN ==27){
					if(myListAllInvoices[i].debDueDate27__c == 0.0){
						myListAllInvoices[i].debDueDate27__c = myListAllInvoices[i].debDueDate27__c + d.debDueDate27__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==27)
				if(positioN ==28){
						myListAllInvoices[i].debDueDate28__c =  myListAllInvoices[i].debDueDate28__c + d.debDueDate28__c;
						isSet = true;
						break;
				}// End if(positioN ==28)
				if(positioN ==29){
						myListAllInvoices[i].debDueDate29__c =myListAllInvoices[i].debDueDate29__c + d.debDueDate29__c;
						isSet = true;
						break;
				}// End if(positioN ==29)
				if(positioN == 30){
						myListAllInvoices[i].debDueDate30__c = myListAllInvoices[i].debDueDate30__c + d.debDueDate30__c;
						isSet = true;
						break;
				}// End if(positioN == 30)
				if(positioN == 31){
						myListAllInvoices[i].debDueDate31__c = myListAllInvoices[i].debDueDate31__c + d.debDueDate31__c;
						isSet = true;
						break;
				}// End if(positioN == 31)
				if(positioN == 32){
						myListAllInvoices[i].debDueDate32__c = myListAllInvoices[i].debDueDate32__c + d.debDueDate32__c;
						isSet = true;
						break;
				}// End if(positioN == 32)
				if(positioN == 33){
						myListAllInvoices[i].debDueDate33__c = myListAllInvoices[i].debDueDate33__c + d.debDueDate33__c;
						isSet = true;
						break;
				}// End if(positioN == 33)
				if(positioN == 34){
						myListAllInvoices[i].debDueDate34__c = myListAllInvoices[i].debDueDate34__c + d.debDueDate34__c;
						isSet = true;
						break;
				}// End if(positioN == 34)
				if(positioN == 35){
						myListAllInvoices[i].debDueDate35__c = myListAllInvoices[i].debDueDate35__c + d.debDueDate35__c;
						isSet = true;
						break;
				}// End if(positioN == 35)
				if(positioN == 36){
						myListAllInvoices[i].debDueDate36__c = myListAllInvoices[i].debDueDate36__c + d.debDueDate36__c;
						isSet = true;
						break;
				}// End if(positioN == 36)
				
				if(positioN == 37){
						myListAllInvoices[i].debDueDate37__c = myListAllInvoices[i].debDueDate37__c + d.debDueDate37__c;
						isSet = true;
						break;
				}// End if(positioN == 37)
				if(positioN == 38){
						myListAllInvoices[i].debDueDate38__c = myListAllInvoices[i].debDueDate38__c + d.debDueDate38__c;
						isSet = true;
						break;
				}// End if(positioN == 38)
				if(positioN == 39){
						myListAllInvoices[i].debDueDate39__c = myListAllInvoices[i].debDueDate39__c + d.debDueDate39__c;
						isSet = true;
						break;
				}// End if(positioN == 39)
				if(positioN == 40){
						myListAllInvoices[i].debDueDate40__c = myListAllInvoices[i].debDueDate40__c + d.debDueDate40__c;
						isSet = true;
						break;
				}// End if(positioN == 40)
				if(positioN == 41){
						myListAllInvoices[i].debDueDate41__c = myListAllInvoices[i].debDueDate41__c + d.debDueDate41__c;
						isSet = true;
						break;
				}// End if(positioN == 41)
				if(positioN == 42){
						myListAllInvoices[i].debDueDate42__c = myListAllInvoices[i].debDueDate42__c + d.debDueDate42__c;
						isSet = true;
						break;
				}// End if(positioN == 42)
				if(positioN == 43){
						myListAllInvoices[i].debDueDate43__c = myListAllInvoices[i].debDueDate43__c + d.debDueDate43__c;
						isSet = true;
						break;
				}// End if(positioN == 43)
				if(positioN == 44){
						myListAllInvoices[i].debDueDate44__c = myListAllInvoices[i].debDueDate44__c + d.debDueDate44__c;
						isSet = true;
						break;
				}// End if(positioN == 44)
				if(positioN == 45){
						myListAllInvoices[i].debDueDate45__c = myListAllInvoices[i].debDueDate45__c + d.debDueDate45__c;
						isSet = true;
						break;
				}// End if(positioN == 45)
			}// End if((myListAllInvoices[i].Opportunity__c ==d.Opportunity__c)&& (isSet==false))
		}// End for(Integer i= 0;i<this.myListAllInvoices.size();i++)
		if(isSet==false){
			myListAllInvoices.add(d);
		}//End if(isSet==false)
		
	}// End public void searchInDebList(DebListObj__c d, Integer position)
	/*
	---------------------------------------- Function to fill all the Amounts in myListAllInvoices---------------------------
	needs a DebListObj and the position where it has do be set. is called by the splittOpps Function
	*/	
	public void searchInDebList(DebListObj__c[] DebList, DebListObj__c d, Integer position){
		Boolean isSet = false;
		// for each DebListObj in myListAllInvoices check if there is a Number at the Position position and the Opportunity id is the same... 
		for(Integer i= 0;i<DebList.size();i++){
			if((DebList[i].Opportunity__c ==d.Opportunity__c)&& (isSet==false)){
				if(positioN ==1){
					
						DebList[i].debDueDate01__c = DebList[i].debDueDate01__c + d.debDueDate01__c;
						isSet = true;
						break;
				
				}// End if(positioN ==1)
				if(positioN ==2){
						DebList[i].debDueDate02__c =  DebList[i].debDueDate02__c + d.debDueDate02__c;
						isSet = true;
						break;
				}// End if(positioN ==2)
				if(positioN == 3){
						DebList[i].debDueDate03__c = DebList[i].debDueDate03__c + d.debDueDate03__c;
						isSet = true;
						break;
				}// End if(positioN == 3)
				if(positioN ==4){
						DebList[i].debDueDate04__c = DebList[i].debDueDate04__c + d.debDueDate04__c;
						isSet = true;
						break;
				}// End if(positioN ==4)
				if(positioN ==5){
						DebList[i].debDueDate05__c = DebList[i].debDueDate05__c +d.debDueDate05__c;
						isSet = true;
						break;
				}// End if(positioN ==5)
				if(positioN ==6){
						DebList[i].debDueDate06__c = DebList[i].debDueDate06__c + d.debDueDate06__c;
						isSet = true;
						break;
				}// End if(positioN ==6)
				if(positioN ==7){
					
						DebList[i].debDueDate07__c = DebList[i].debDueDate07__c + d.debDueDate07__c;
						isSet = true;
						break;
				}// End if(positioN ==7)
				if(positioN ==8){
					
						DebList[i].debDueDate08__c = DebList[i].debDueDate08__c + d.debDueDate08__c;
						isSet = true;
						break;
				}// End if(positioN ==8)
				if(positioN ==9){
						DebList[i].debDueDate09__c = DebList[i].debDueDate09__c + d.debDueDate09__c;
						isSet = true;
						break;
				}// End if(positioN ==9)
				if(positioN ==10){
						DebList[i].debDueDate10__c = DebList[i].debDueDate10__c + d.debDueDate10__c;
						isSet = true;
						break;
				}// End if(positioN ==10)
				if(positioN ==11){
						DebList[i].debDueDate11__c = DebList[i].debDueDate11__c + d.debDueDate11__c;
						isSet = true;
						break;
				}// End if(positioN ==11)
				if(positioN ==12){
						DebList[i].debDueDate12__c = DebList[i].debDueDate12__c + d.debDueDate12__c;
						isSet = true;
						break;
				}// End if(positioN ==12)
				if(positioN ==13){
						DebList[i].debDueDate13__c = DebList[i].debDueDate13__c + d.debDueDate13__c;
						isSet = true;
						break;
				}// End if(positioN ==13)
				if(positioN ==14){
						DebList[i].debDueDate14__c = DebList[i].debDueDate14__c + d.debDueDate14__c;
						isSet = true;
						break;
				}// End if(positioN ==14)
				if(positioN ==15){
						DebList[i].debDueDate15__c = DebList[i].debDueDate15__c + d.debDueDate15__c;
						isSet = true;
						break;
				}// End if(positioN ==15)
				if(positioN ==16){
						DebList[i].debDueDate16__c = DebList[i].debDueDate16__c + d.debDueDate16__c;
						isSet = true;
						break;
				}// End if(positioN ==16)
				if(positioN ==17){
					
						DebList[i].debDueDate17__c = DebList[i].debDueDate17__c + d.debDueDate17__c;
						isSet = true;
						break;
				}// End if(positioN ==17)
				if(positioN ==18){
						DebList[i].debDueDate18__c = DebList[i].debDueDate18__c + d.debDueDate18__c;
						isSet = true;
						break;
				}// End if(positioN ==18)
				if(positioN ==19){
						DebList[i].debDueDate19__c = DebList[i].debDueDate19__c + d.debDueDate19__c;
						isSet = true;
						break;
				}// End if(positioN ==19)
				if(positioN ==20){
						DebList[i].debDueDate20__c = DebList[i].debDueDate20__c + d.debDueDate20__c;
						isSet = true;
						break;
				}// End if(positioN ==20)
				if(positioN ==21){
						DebList[i].debDueDate21__c = DebList[i].debDueDate21__c + d.debDueDate21__c;
						isSet = true;
						break;
				}// End if(positioN ==21)
				if(positioN ==22){
						DebList[i].debDueDate22__c = DebList[i].debDueDate22__c + d.debDueDate22__c;
						isSet = true;
						break;
				}// End if(positioN ==22)
				if(positioN ==23){

						DebList[i].debDueDate23__c = DebList[i].debDueDate23__c + d.debDueDate23__c;
						isSet = true;
						break;
				}// End if(positioN ==23)
				if(positioN ==24){
						DebList[i].debDueDate24__c = DebList[i].debDueDate24__c + d.debDueDate24__c;
						isSet = true;
						break;

				}// End if(positioN ==24)
				if(positioN ==25){
					
						DebList[i].debDueDate25__c = DebList[i].debDueDate25__c + d.debDueDate25__c;
						isSet = true;
						break;
					
				}// End if(positioN ==25)
				if(positioN ==26){
						DebList[i].debDueDate26__c = DebList[i].debDueDate26__c + d.debDueDate26__c;
						isSet = true;
						break;
				}// End if(positioN ==26)
				if(positioN ==27){
						DebList[i].debDueDate27__c = DebList[i].debDueDate27__c + d.debDueDate27__c;
						isSet = true;
						break;
				}// End if(positioN ==27)
				if(positioN ==28){
						DebList[i].debDueDate28__c =  DebList[i].debDueDate28__c + d.debDueDate28__c;
						isSet = true;
						break;
				}// End if(positioN ==28)
				if(positioN ==29){
						DebList[i].debDueDate29__c =DebList[i].debDueDate29__c + d.debDueDate29__c;
						isSet = true;
						break;
				}// End if(positioN ==29)
				if(positioN == 30){
						DebList[i].debDueDate30__c = DebList[i].debDueDate30__c + d.debDueDate30__c;
						isSet = true;
						break;
				}// End if(positioN == 30)
				if(positioN == 31){
						DebList[i].debDueDate31__c = DebList[i].debDueDate31__c + d.debDueDate31__c;
						isSet = true;
						break;
				}// End if(positioN == 31)
				
			}// End if((myListAllInvoices[i].Opportunity__c ==d.Opportunity__c)&& (isSet==false))
		}// End for(Integer i= 0;i<this.myListAllInvoices.size();i++)
		if(isSet==false){
			DebList.add(d);
		}//End if(isSet==false)
		
	}// End public void searchInDebList(DebListObj__c d, Integer position)
	
		/*
	---------------------------------------- Function to fill all the Amounts in myListAllInvoices---------------------------
	needs a DebListObj and the position where it has do be set. is called by the splittOpps Function
	*/	
	public void searchInmyListOnlyDeb( DebListObj__c d, Integer position){
		Boolean isSet = false;
		// for each DebListObj in myListAllInvoices check if there is a Number at the Position position and the Opportunity id is the same... 
		for(Integer i= 0;i<myListOnlyDeb.size();i++){
			if((myListOnlyDeb[i].Opportunity__c ==d.Opportunity__c)&& (isSet==false)){
				if(positioN ==1){
					
						myListOnlyDeb[i].debDueDate01__c = myListOnlyDeb[i].debDueDate01__c + d.debDueDate01__c;
						isSet = true;
						break;
				
				}// End if(positioN ==1)
				if(positioN ==2){
						myListOnlyDeb[i].debDueDate02__c =  myListOnlyDeb[i].debDueDate02__c + d.debDueDate02__c;
						isSet = true;
						break;
				}// End if(positioN ==2)
				if(positioN == 3){
						myListOnlyDeb[i].debDueDate03__c = myListOnlyDeb[i].debDueDate03__c + d.debDueDate03__c;
						isSet = true;
						break;
				}// End if(positioN == 3)
				if(positioN ==4){
						myListOnlyDeb[i].debDueDate04__c = myListOnlyDeb[i].debDueDate04__c + d.debDueDate04__c;
						isSet = true;
						break;
				}// End if(positioN ==4)
				if(positioN ==5){
						myListOnlyDeb[i].debDueDate05__c = myListOnlyDeb[i].debDueDate05__c +d.debDueDate05__c;
						isSet = true;
						break;
				}// End if(positioN ==5)
				if(positioN ==6){
						myListOnlyDeb[i].debDueDate06__c = myListOnlyDeb[i].debDueDate06__c + d.debDueDate06__c;
						isSet = true;
						break;
				}// End if(positioN ==6)
				if(positioN ==7){
					
						myListOnlyDeb[i].debDueDate07__c = myListOnlyDeb[i].debDueDate07__c + d.debDueDate07__c;
						isSet = true;
						break;
				}// End if(positioN ==7)
				if(positioN ==8){
					
						myListOnlyDeb[i].debDueDate08__c = myListOnlyDeb[i].debDueDate08__c + d.debDueDate08__c;
						isSet = true;
						break;
				}// End if(positioN ==8)
				if(positioN ==9){
						myListOnlyDeb[i].debDueDate09__c = myListOnlyDeb[i].debDueDate09__c + d.debDueDate09__c;
						isSet = true;
						break;
				}// End if(positioN ==9)
				if(positioN ==10){
						myListOnlyDeb[i].debDueDate10__c = myListOnlyDeb[i].debDueDate10__c + d.debDueDate10__c;
						isSet = true;
						break;
				}// End if(positioN ==10)
				if(positioN ==11){
						myListOnlyDeb[i].debDueDate11__c = myListOnlyDeb[i].debDueDate11__c + d.debDueDate11__c;
						isSet = true;
						break;
				}// End if(positioN ==11)
				if(positioN ==12){
						myListOnlyDeb[i].debDueDate12__c = myListOnlyDeb[i].debDueDate12__c + d.debDueDate12__c;
						isSet = true;
						break;
				}// End if(positioN ==12)
				if(positioN ==13){
						myListOnlyDeb[i].debDueDate13__c = myListOnlyDeb[i].debDueDate13__c + d.debDueDate13__c;
						isSet = true;
						break;
				}// End if(positioN ==13)
				if(positioN ==14){
						myListOnlyDeb[i].debDueDate14__c = myListOnlyDeb[i].debDueDate14__c + d.debDueDate14__c;
						isSet = true;
						break;
				}// End if(positioN ==14)
				if(positioN ==15){
						myListOnlyDeb[i].debDueDate15__c = myListOnlyDeb[i].debDueDate15__c + d.debDueDate15__c;
						isSet = true;
						break;
				}// End if(positioN ==15)
				if(positioN ==16){
						myListOnlyDeb[i].debDueDate16__c = myListOnlyDeb[i].debDueDate16__c + d.debDueDate16__c;
						isSet = true;
						break;
				}// End if(positioN ==16)
				if(positioN ==17){
					
						myListOnlyDeb[i].debDueDate17__c = myListOnlyDeb[i].debDueDate17__c + d.debDueDate17__c;
						isSet = true;
						break;
				}// End if(positioN ==17)
				if(positioN ==18){
						myListOnlyDeb[i].debDueDate18__c = myListOnlyDeb[i].debDueDate18__c + d.debDueDate18__c;
						isSet = true;
						break;
				}// End if(positioN ==18)
				if(positioN ==19){
						myListOnlyDeb[i].debDueDate19__c = myListOnlyDeb[i].debDueDate19__c + d.debDueDate19__c;
						isSet = true;
						break;
				}// End if(positioN ==19)
				if(positioN ==20){
						myListOnlyDeb[i].debDueDate20__c = myListOnlyDeb[i].debDueDate20__c + d.debDueDate20__c;
						isSet = true;
						break;
				}// End if(positioN ==20)
				if(positioN ==21){
						myListOnlyDeb[i].debDueDate21__c = myListOnlyDeb[i].debDueDate21__c + d.debDueDate21__c;
						isSet = true;
						break;
				}// End if(positioN ==21)
				if(positioN ==22){
						myListOnlyDeb[i].debDueDate22__c = myListOnlyDeb[i].debDueDate22__c + d.debDueDate22__c;
						isSet = true;
						break;
				}// End if(positioN ==22)
				if(positioN ==23){

						myListOnlyDeb[i].debDueDate23__c = myListOnlyDeb[i].debDueDate23__c + d.debDueDate23__c;
						isSet = true;
						break;
				}// End if(positioN ==23)
				if(positioN ==24){
						myListOnlyDeb[i].debDueDate24__c = myListOnlyDeb[i].debDueDate24__c + d.debDueDate24__c;
						isSet = true;
						break;

				}// End if(positioN ==24)
				if(positioN ==25){
					
						myListOnlyDeb[i].debDueDate25__c = myListOnlyDeb[i].debDueDate25__c + d.debDueDate25__c;
						isSet = true;
						break;
					
				}// End if(positioN ==25)
				if(positioN ==26){
						myListOnlyDeb[i].debDueDate26__c = myListOnlyDeb[i].debDueDate26__c + d.debDueDate26__c;
						isSet = true;
						break;
				}// End if(positioN ==26)
				if(positioN ==27){
						myListOnlyDeb[i].debDueDate27__c = myListOnlyDeb[i].debDueDate27__c + d.debDueDate27__c;
						isSet = true;
						break;
				}// End if(positioN ==27)
				if(positioN ==28){
						myListOnlyDeb[i].debDueDate28__c =  myListOnlyDeb[i].debDueDate28__c + d.debDueDate28__c;
						isSet = true;
						break;
				}// End if(positioN ==28)
				if(positioN ==29){
						myListOnlyDeb[i].debDueDate29__c =myListOnlyDeb[i].debDueDate29__c + d.debDueDate29__c;
						isSet = true;
						break;
				}// End if(positioN ==29)
				if(positioN == 30){
						myListOnlyDeb[i].debDueDate30__c = myListOnlyDeb[i].debDueDate30__c + d.debDueDate30__c;
						isSet = true;
						break;
				}// End if(positioN == 30)
				if(positioN == 31){
						myListOnlyDeb[i].debDueDate31__c = myListOnlyDeb[i].debDueDate31__c + d.debDueDate31__c;
						isSet = true;
						break;
				}// End if(positioN == 31)
				
			}// End if((myListAllInvoices[i].Opportunity__c ==d.Opportunity__c)&& (isSet==false))
		}// End for(Integer i= 0;i<this.myListAllInvoices.size();i++)
		if(isSet==false){
			myListOnlyDeb.add(d);
		}//End if(isSet==false)
		
	}// End public void searchInmyListOnlyDeb(DebListObj__c d, Integer position)  
	/*
	public void searchInDebList(DebListObj__c[] DebList, DebListObj__c d, Integer position){
		Boolean isSet = false;
		// for each DebListObj in myListAllInvoices check if there is a Number at the Position position and the Opportunity id is the same... 
		for(Integer i= 0;i<DebList.size();i++){
			if((DebList[i].Opportunity__c ==d.Opportunity__c)&& (isSet==false)){
				if(positioN ==1){
					if(DebList[i].debDueDate01__c == 0.0){
						DebList[i].debDueDate01__c = d.debDueDate01__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==1)
				if(positioN ==2){
					if(DebList[i].debDueDate02__c == 0.0){
						DebList[i].debDueDate02__c = d.debDueDate02__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==2)
				if(positioN == 3){
					if(DebList[i].debDueDate03__c == 0.0){
						DebList[i].debDueDate03__c = d.debDueDate03__c;
						isSet = true;
						break;
					}
				}// End if(positioN == 3)
				if(positioN ==4){
					if(DebList[i].debDueDate04__c == 0.0){
						DebList[i].debDueDate04__c = d.debDueDate04__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==4)
				if(positioN ==5){
					if(DebList[i].debDueDate05__c == 0.0){
						DebList[i].debDueDate05__c = d.debDueDate05__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==5)
				if(positioN ==6){
					if(DebList[i].debDueDate06__c == 0.0){
						DebList[i].debDueDate06__c = d.debDueDate06__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==6)
				if(positioN ==7){
					if(DebList[i].debDueDate07__c == 0.0){
						DebList[i].debDueDate07__c = d.debDueDate07__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==7)
				if(positioN ==8){
					if(DebList[i].debDueDate08__c == 0.0){
						DebList[i].debDueDate08__c = d.debDueDate08__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==8)
				if(positioN ==9){
					if(DebList[i].debDueDate09__c == 0.0){
						DebList[i].debDueDate09__c = d.debDueDate09__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==9)
				if(positioN ==10){
					if(DebList[i].debDueDate10__c == 0.0){
						DebList[i].debDueDate10__c = d.debDueDate10__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==10)
				if(positioN ==11){
					if(DebList[i].debDueDate11__c == 0.0){
						DebList[i].debDueDate11__c = d.debDueDate11__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==11)
				if(positioN ==12){
					if(DebList[i].debDueDate12__c == 0.0){
						DebList[i].debDueDate12__c = d.debDueDate12__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==12)
				if(positioN ==13){
					if(DebList[i].debDueDate13__c == 0.0){
						DebList[i].debDueDate13__c = d.debDueDate13__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==13)
				if(positioN ==14){
					if(DebList[i].debDueDate14__c == 0.0){
						DebList[i].debDueDate14__c = d.debDueDate14__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==14)
				if(positioN ==15){
					if(DebList[i].debDueDate15__c == 0.0){
						DebList[i].debDueDate15__c = d.debDueDate15__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==15)
				if(positioN ==16){
					if(DebList[i].debDueDate16__c == 0.0){
						DebList[i].debDueDate16__c = d.debDueDate16__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==16)
				if(positioN ==17){
					if(DebList[i].debDueDate17__c == 0.0){
						DebList[i].debDueDate17__c = d.debDueDate17__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==17)
				if(positioN ==18){
					if(DebList[i].debDueDate18__c == 0.0){
						DebList[i].debDueDate18__c = d.debDueDate18__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==18)
				if(positioN ==19){
					if(DebList[i].debDueDate19__c == 0.0){
						DebList[i].debDueDate19__c = d.debDueDate19__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==19)
				if(positioN ==20){
					if(DebList[i].debDueDate20__c == 0.0){
						DebList[i].debDueDate20__c = d.debDueDate20__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==20)
				if(positioN ==21){
					if(DebList[i].debDueDate21__c == 0.0){
						DebList[i].debDueDate21__c = d.debDueDate21__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==21)
				if(positioN ==22){
					if(DebList[i].debDueDate22__c == 0.0){
						DebList[i].debDueDate22__c = d.debDueDate22__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==22)
				if(positioN ==23){
					if(DebList[i].debDueDate23__c == 0.0){
						DebList[i].debDueDate23__c = d.debDueDate23__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==23)
				if(positioN ==24){
					if(DebList[i].debDueDate24__c == 0.0){
						DebList[i].debDueDate24__c = d.debDueDate24__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==24)
				if(positioN ==25){
					if(DebList[i].debDueDate25__c == 0.0){
						DebList[i].debDueDate25__c = d.debDueDate25__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==25)
				if(positioN ==26){
					if(DebList[i].debDueDate26__c == 0.0){
						DebList[i].debDueDate26__c = d.debDueDate26__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==26)
				if(positioN ==27){
					if(DebList[i].debDueDate27__c == 0.0){
						DebList[i].debDueDate27__c = d.debDueDate27__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==27)
				if(positioN ==28){
					if(DebList[i].debDueDate28__c == 0.0){
						DebList[i].debDueDate28__c = d.debDueDate28__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==28)
				if(positioN ==29){
					if(DebList[i].debDueDate29__c == 0.0){
						DebList[i].debDueDate29__c = d.debDueDate29__c;
						isSet = true;
						break;
					}
				}// End if(positioN ==29)
				if(positioN == 30){
					if(DebList[i].debDueDate30__c == 0.0){
						DebList[i].debDueDate30__c = d.debDueDate30__c;
						isSet = true;
						break;
					}
				}// End if(positioN == 30)
				if(positioN == 31){
					if(DebList[i].debDueDate31__c == 0.0){
						DebList[i].debDueDate31__c = d.debDueDate31__c;
						isSet = true;
						break;
					}
				}// End if(positioN == 31)
				
			}// End if((myListAllInvoices[i].Opportunity__c ==d.Opportunity__c)&& (isSet==false))
		}// End for(Integer i= 0;i<this.myListAllInvoices.size();i++)
		if(isSet==false){
			DebList.add(d);
		}//End if(isSet==false)
		
	}// End public void searchInDebList(DebListObj__c d, Integer position) 
*/
	/* 
	------------------------------------------ Function to fill the Result List --------------------------------------
	*/
	public void fillResult(){
		
		// if the List of Debitoren and Kreditoren is not null
		if(this.myListAllInvoices.size()>0){
			//temp DebListObj
			DebListObj__c result = new DebListObj__c(debDueDate01__c = 0,debDueDate02__c = 0,debDueDate03__c = 0,debDueDate04__c = 0,debDueDate05__c = 0,debDueDate06__c = 0,debDueDate07__c = 0, debDueDate08__c = 0,
					debDueDate09__c = 0,debDueDate10__c = 0,debDueDate11__c = 0,debDueDate12__c = 0,debDueDate13__c = 0,debDueDate14__c = 0,debDueDate15__c = 0,debDueDate16__c = 0,
					debDueDate17__c = 0,debDueDate18__c = 0,debDueDate19__c = 0,debDueDate20__c = 0,debDueDate21__c = 0,debDueDate22__c = 0,debDueDate23__c = 0,debDueDate24__c = 0,
					debDueDate25__c = 0,debDueDate26__c = 0,debDueDate27__c = 0,debDueDate28__c = 0,debDueDate29__c = 0,debDueDate30__c = 0,debDueDate31__c = 0, debDueDate32__c = 0,
					debDueDate33__c = 0,debDueDate34__c = 0,debDueDate35__c = 0,debDueDate36__c = 0,debDueDate37__c = 0,debDueDate38__c = 0,debDueDate39__c = 0, debDueDate40__c = 0,
					debDueDate41__c = 0,debDueDate42__c = 0,debDueDate43__c = 0,debDueDate44__c = 0,debDueDate45__c = 0);
			for(Integer i= 0;i<myListAllInvoices.size();i++){
				result.debDueDate01__c = result.debDueDate01__c +  myListAllInvoices[i].debDueDate01__c;
				result.debDueDate02__c = result.debDueDate02__c +  myListAllInvoices[i].debDueDate02__c;
				result.debDueDate03__c = result.debDueDate03__c +  myListAllInvoices[i].debDueDate03__c;
				result.debDueDate04__c = result.debDueDate04__c +  myListAllInvoices[i].debDueDate04__c;
				result.debDueDate05__c = result.debDueDate05__c +  myListAllInvoices[i].debDueDate05__c;
				result.debDueDate06__c = result.debDueDate06__c +  myListAllInvoices[i].debDueDate06__c;
				result.debDueDate07__c = result.debDueDate07__c +  myListAllInvoices[i].debDueDate07__c;
				result.debDueDate08__c = result.debDueDate08__c +  myListAllInvoices[i].debDueDate08__c;
				result.debDueDate09__c = result.debDueDate09__c +  myListAllInvoices[i].debDueDate09__c;
				result.debDueDate10__c = result.debDueDate10__c +  myListAllInvoices[i].debDueDate10__c;
				result.debDueDate11__c = result.debDueDate11__c +  myListAllInvoices[i].debDueDate11__c;
				result.debDueDate12__c = result.debDueDate12__c +  myListAllInvoices[i].debDueDate12__c;
				result.debDueDate13__c = result.debDueDate13__c +  myListAllInvoices[i].debDueDate13__c;
				result.debDueDate14__c = result.debDueDate14__c +  myListAllInvoices[i].debDueDate14__c;
				result.debDueDate15__c = result.debDueDate15__c +  myListAllInvoices[i].debDueDate15__c;
				result.debDueDate16__c = result.debDueDate16__c +  myListAllInvoices[i].debDueDate16__c;
				result.debDueDate17__c = result.debDueDate17__c +  myListAllInvoices[i].debDueDate17__c;
				result.debDueDate18__c = result.debDueDate18__c +  myListAllInvoices[i].debDueDate18__c;
				result.debDueDate19__c = result.debDueDate19__c +  myListAllInvoices[i].debDueDate19__c;
				result.debDueDate20__c = result.debDueDate20__c +  myListAllInvoices[i].debDueDate20__c;
				result.debDueDate21__c = result.debDueDate21__c +  myListAllInvoices[i].debDueDate21__c;
				result.debDueDate22__c = result.debDueDate22__c +  myListAllInvoices[i].debDueDate22__c;
				result.debDueDate23__c = result.debDueDate23__c +  myListAllInvoices[i].debDueDate23__c;
				result.debDueDate24__c = result.debDueDate24__c +  myListAllInvoices[i].debDueDate24__c;
				result.debDueDate25__c = result.debDueDate25__c +  myListAllInvoices[i].debDueDate25__c;
				result.debDueDate26__c = result.debDueDate26__c +  myListAllInvoices[i].debDueDate26__c;
				result.debDueDate27__c = result.debDueDate27__c +  myListAllInvoices[i].debDueDate27__c;
				result.debDueDate28__c = result.debDueDate28__c +  myListAllInvoices[i].debDueDate28__c;
				result.debDueDate29__c = result.debDueDate29__c +  myListAllInvoices[i].debDueDate29__c;
				result.debDueDate30__c = result.debDueDate30__c +  myListAllInvoices[i].debDueDate30__c;
				result.debDueDate31__c = result.debDueDate31__c +  myListAllInvoices[i].debDueDate31__c;
				
				result.debDueDate32__c = result.debDueDate32__c +  myListAllInvoices[i].debDueDate32__c;
				result.debDueDate33__c = result.debDueDate33__c +  myListAllInvoices[i].debDueDate33__c;
				result.debDueDate34__c = result.debDueDate34__c +  myListAllInvoices[i].debDueDate34__c;
				result.debDueDate35__c = result.debDueDate35__c +  myListAllInvoices[i].debDueDate35__c;
				result.debDueDate36__c = result.debDueDate36__c +  myListAllInvoices[i].debDueDate36__c;
				result.debDueDate37__c = result.debDueDate37__c +  myListAllInvoices[i].debDueDate37__c;
				result.debDueDate38__c = result.debDueDate38__c +  myListAllInvoices[i].debDueDate38__c;
				result.debDueDate39__c = result.debDueDate39__c +  myListAllInvoices[i].debDueDate39__c;
				result.debDueDate40__c = result.debDueDate40__c +  myListAllInvoices[i].debDueDate40__c;
				result.debDueDate41__c = result.debDueDate41__c +  myListAllInvoices[i].debDueDate41__c;
				result.debDueDate42__c = result.debDueDate42__c +  myListAllInvoices[i].debDueDate42__c;
				result.debDueDate43__c = result.debDueDate43__c +  myListAllInvoices[i].debDueDate43__c;
				result.debDueDate44__c = result.debDueDate44__c +  myListAllInvoices[i].debDueDate44__c;
				result.debDueDate45__c = result.debDueDate45__c +  myListAllInvoices[i].debDueDate45__c;
				
				
			}// End for(Integer i= 0;i<myListAllInvoices.size();i++
			resultDoubleMap.put(1,result.debDueDate01__c);
			resultDoubleMap.put(2,result.debDueDate02__c);
			resultDoubleMap.put(3,result.debDueDate03__c);
			resultDoubleMap.put(4,result.debDueDate04__c);
			resultDoubleMap.put(5,result.debDueDate05__c);
			resultDoubleMap.put(6,result.debDueDate06__c);
			resultDoubleMap.put(7,result.debDueDate07__c);
			resultDoubleMap.put(8,result.debDueDate08__c);
			resultDoubleMap.put(9,result.debDueDate09__c);
			resultDoubleMap.put(10,result.debDueDate10__c);
			resultDoubleMap.put(11,result.debDueDate11__c);
			resultDoubleMap.put(12,result.debDueDate12__c);
			resultDoubleMap.put(13,result.debDueDate13__c);
			resultDoubleMap.put(14,result.debDueDate14__c);
			resultDoubleMap.put(15,result.debDueDate15__c);
			resultDoubleMap.put(16,result.debDueDate16__c);
			resultDoubleMap.put(17,result.debDueDate17__c);
			resultDoubleMap.put(18,result.debDueDate18__c);
			resultDoubleMap.put(19,result.debDueDate19__c);
			resultDoubleMap.put(20,result.debDueDate20__c);
			resultDoubleMap.put(21,result.debDueDate21__c);
			resultDoubleMap.put(22,result.debDueDate22__c);
			resultDoubleMap.put(23,result.debDueDate23__c);
			resultDoubleMap.put(24,result.debDueDate24__c);
			resultDoubleMap.put(25,result.debDueDate25__c);
			resultDoubleMap.put(26,result.debDueDate26__c);
			resultDoubleMap.put(27,result.debDueDate27__c);
			resultDoubleMap.put(28,result.debDueDate28__c);
			resultDoubleMap.put(29,result.debDueDate29__c);
			resultDoubleMap.put(30,result.debDueDate30__c);
			resultDoubleMap.put(31,result.debDueDate31__c);
			
			resultDoubleMap.put(32,result.debDueDate32__c);
			resultDoubleMap.put(33,result.debDueDate33__c);
			resultDoubleMap.put(34,result.debDueDate34__c);
			resultDoubleMap.put(35,result.debDueDate35__c);
			resultDoubleMap.put(36,result.debDueDate36__c);
			resultDoubleMap.put(37,result.debDueDate37__c);
			resultDoubleMap.put(38,result.debDueDate38__c);
			resultDoubleMap.put(39,result.debDueDate39__c);
			resultDoubleMap.put(40,result.debDueDate40__c);
			resultDoubleMap.put(41,result.debDueDate41__c);
			resultDoubleMap.put(42,result.debDueDate42__c);
			resultDoubleMap.put(43,result.debDueDate43__c);
			resultDoubleMap.put(44,result.debDueDate44__c);
			resultDoubleMap.put(45,result.debDueDate45__c);
			sizeresultDoublemap = resultDoubleMap.size();
			myResultList.add(result);
		}// End if(this.myListAllInvoices.size()>0)
	}// End public void fillResult()
}// END public with sharing class CashFlow3